package BD;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;

public class Conexion {

	/*	Base de Datos*/
	private final static String drv = "com.mysql.jdbc.Driver";
	private final static String db =  "jdbc:mysql://localhost:3306/cine"; // Base de Datos
	private final static String user = "root";
	private final static String pass = "";
	private static Connection ct;
	private static Statement st;

	public String conexion()
	{
	
		/******* Conexion con la base de datos *********/
		try {
			Class.forName(drv);
			ct = DriverManager.getConnection(db,user,pass);
			setSt(ct.createStatement());
		
			return "Conexion exitosa";
		
		} catch (Exception e) {
			return "No se pudo conectar a la BD";
		}
	}

	public static void setSt(Statement st) {
		Conexion.st = st;
	}

	public static Statement getSt() {
		return st;
	}

}
